﻿<Controls:PhoneApplicationPage x:Class="TexasHoldemCalculator.View.StartingHandsView"
                               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                               xmlns:Controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                               xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                               xmlns:holdem="clr-namespace:Holdem.Core.Controls;assembly=Holdem.Core"
                               xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                               xmlns:MvvmLite="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"
                               x:Name="StartingHandsViewPage"
                               ApplicationBar="{StaticResource GlobalApplicationBar}"
                               d:DesignHeight="800"
                               d:DesignWidth="480"
                               Style="{StaticResource DefaultPageTransition}"
                               SupportedOrientations="Portrait"
                               mc:Ignorable="d">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="55" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <HyperlinkButton Name="StartingHandsTitle"
                         Grid.Row="0"
                         DataContext="{Binding Source={StaticResource Locator}, Path=StartingHands}"
                         Content="{Binding Title}"
                         Style="{StaticResource THCStartingHandsLinkHeaderStyle}">
            <i:Interaction.Triggers>
                <Custom:EventTrigger EventName="Click">
                    <MvvmLite:EventToCommand x:Name="LinkVisibilitySelectCommand" Command="{Binding Visibility2Command}" />
                </Custom:EventTrigger>
            </i:Interaction.Triggers>
        </HyperlinkButton>
        <holdem:StartingHandsGrid x:Name="StartingHandsGrid"
                                  Grid.Row="1"
                                  Margin="2" 
                                  DataContext="{Binding}">
            <Custom:Interaction.Triggers>
                <Custom:EventTrigger EventName="Click">
                    <MvvmLite:EventToCommand x:Name="StartingHandSelectedCommand"
                                             Command="{Binding ElementName=StartingHandsTitle,
                                                               Path=DataContext.StartingHandSelectedCommand}"
                                             CommandParameter="{Binding ElementName=StartingHandsGrid,
                                                                        Path=SelectedButton}" />
                </Custom:EventTrigger>
            </Custom:Interaction.Triggers>
        </holdem:StartingHandsGrid>

        <ItemsControl Grid.Row="0" Grid.RowSpan="2"
                      Visibility="Visible"
                      x:Name="HandPopup"
                      Template="{StaticResource StartingHandsProgressIndicatorControleTemplate}" />

        <ItemsControl Grid.Row="0" Grid.RowSpan="2"
                      x:Name="HandSelectionPopup"
                      DataContext="{Binding Source={StaticResource Locator}, Path=StartingHands}"
                      Template="{StaticResource StartingHandsDescriptionControlTemplate}" 
                      Visibility="{Binding Visibility2}" />

        <ItemsControl Grid.Row="0" Grid.RowSpan="2"
                      x:Name="HandDescriptionPopup"
                      DataContext="{Binding Source={StaticResource Locator}, Path=StartingHands}"
                      Template="{StaticResource StartingHandsSelectedHandControlTemplate}" 
                      Visibility="{Binding OutsVisibility}" />
    </Grid>
</Controls:PhoneApplicationPage>